import React from 'react';
import classNames from 'classnames';

import * as Util from '../common/Util';

import {
  Row,
  Col,
  Panel
} from 'react-bootstrap';

class RechargeRecord extends React.Component {

  constructor() {
    super();
  }

  static propTypes = {
      
  }

  formatRecordLsh(){
    let { record } = this.props;
    let lsh = "";
    if (record) {
      let lshLength = "00000000".length;
      let thisLength = record.lsh.length;
      lsh = "BCD" + (new Array(lshLength - thisLength).join("0")) + record.lsh;
    }
    return lsh;
  }

  render(){

      let { record } = this.props;

      return (
            record && record.lsh !== ""?
            <Panel className="record-item">
                <Row>
                  <Col xs={3}>
                    <div className="border-right">
                      <p className="text-primary">获得积分</p>
                      <h2 className="text-danger">
                          {record.cash}
                      </h2>
                    </div>
                  </Col>
                  <Col xs={8} xsOffset={1}>
                      <div className="text-right">
                        <p className="text-primary">
                          充值方式：{record.cashdescr}
                        </p>
                        <p className="text-primary">
                          流水号：{this.formatRecordLsh()}
                        </p>
                        <p className="text-muted">
                          { Util.DateFormater(record.createtime, 'yyyy-MM-dd') }
                        </p>
                    </div>
                  </Col>
                </Row>
            </Panel>
            :null
      );
  }
}

export default RechargeRecord;